package com.cjy.ComparatorDemo1;

import java.util.Comparator;

public class Test1 {
    public static void main(String[] args) {
        ComparatorBusiness g1 = new ComparatorBusiness("黄鹤楼",251);
        ComparatorBusiness g2 = new ComparatorBusiness("黄鹤楼",2666);
        ComparatorBusiness g3 = new ComparatorBusiness("黄鹤楼",28);
        ComparatorBusiness g4 = new ComparatorBusiness("黄鹤楼",27);

        System.out.println(max(g1,g2,g3,new ComparatorClass()).getGrades());
    }
    public static ComparatorBusiness max(ComparatorBusiness a, ComparatorBusiness b, ComparatorBusiness c, Comparator<ComparatorBusiness> d){
        ComparatorBusiness bbb;
        if (d.compare(a,b)>0){
            bbb = a;
        }else {
            bbb = b;
        }
        if (d.compare(bbb,c)>0){
            return bbb;
        }else {
            return bbb = c;
        }
    }
}
